.class public Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;
.super Ljava/lang/Object;
.source "CommentParser.java"


# static fields
.field private static final AUTHOR:Ljava/lang/String; = "author"

.field private static final CARID:Ljava/lang/String; = "carid"

.field private static final CARNAME:Ljava/lang/String; = "carname"

.field private static final CONTENT:Ljava/lang/String; = "content"

.field private static final ID:Ljava/lang/String; = "id"

.field private static final LEVEL:Ljava/lang/String; = "level"

.field private static final POSTSUM:Ljava/lang/String; = "postsum"

.field private static final TAG:Ljava/lang/String; = "tag"

.field private static final TITLE:Ljava/lang/String; = "title"

.field private static final UPDATED:Ljava/lang/String; = "updated"

.field private static final URL:Ljava/lang/String; = "url"

.field private static final VIEWSUM:Ljava/lang/String; = "viewsum"


# instance fields
.field private TA_G:Ljava/lang/String;

.field private badcommentList:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/Comment;",
            ">;"
        }
    .end annotation
.end field

.field private generalCommentList:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/Comment;",
            ">;"
        }
    .end annotation
.end field

.field private goodCommentList:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/Comment;",
            ">;"
        }
    .end annotation
.end field

.field private url:Ljava/lang/String;


# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 1
    .parameter "url"

    .prologue
    .line 52
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 49
    const-string v0, ""

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->url:Ljava/lang/String;

    .line 50
    const-string v0, "CommentParser"

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->TA_G:Ljava/lang/String;

    .line 53
    iput-object p1, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->url:Ljava/lang/String;

    .line 54
    return-void
.end method


# virtual methods
.method public Paser2Object()V
    .locals 10

    .prologue
    const/4 v9, 0x0

    .line 70
    :try_start_0
    new-instance v6, Ljava/util/ArrayList;

    invoke-direct {v6}, Ljava/util/ArrayList;-><init>()V

    iput-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->goodCommentList:Ljava/util/ArrayList;

    .line 71
    new-instance v6, Ljava/util/ArrayList;

    invoke-direct {v6}, Ljava/util/ArrayList;-><init>()V

    iput-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->generalCommentList:Ljava/util/ArrayList;

    .line 72
    new-instance v6, Ljava/util/ArrayList;

    invoke-direct {v6}, Ljava/util/ArrayList;-><init>()V

    iput-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->badcommentList:Ljava/util/ArrayList;

    .line 73
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->url:Ljava/lang/String;

    invoke-static {v6}, Lcom/bitauto/autoeasy/tool/Caller;->doGet(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    .line 74
    .local v5, str:Ljava/lang/String;
    if-eqz v5, :cond_0

    .line 75
    new-instance v4, Lorg/json/JSONObject;

    invoke-direct {v4, v5}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 77
    .local v4, jObj:Lorg/json/JSONObject;
    const-string v6, "feed"

    invoke-virtual {v4, v6}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v6

    const-string v7, "entry"

    invoke-virtual {v6, v7}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v3

    .line 78
    .local v3, jArr:Lorg/json/JSONArray;
    invoke-virtual {v3}, Lorg/json/JSONArray;->length()I

    move-result v6

    if-lez v6, :cond_0

    .line 80
    const/4 v2, 0x0

    .local v2, i:I
    :goto_0
    invoke-virtual {v3}, Lorg/json/JSONArray;->length()I

    move-result v6

    if-lt v2, v6, :cond_1

    .line 115
    .end local v2           #i:I
    .end local v3           #jArr:Lorg/json/JSONArray;
    .end local v4           #jObj:Lorg/json/JSONObject;
    .end local v5           #str:Ljava/lang/String;
    :cond_0
    :goto_1
    return-void

    .line 81
    .restart local v2       #i:I
    .restart local v3       #jArr:Lorg/json/JSONArray;
    .restart local v4       #jObj:Lorg/json/JSONObject;
    .restart local v5       #str:Ljava/lang/String;
    :cond_1
    invoke-virtual {v3, v2}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v6

    invoke-virtual {p0, v6}, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->createComment(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/Comment;

    move-result-object v0

    .line 82
    .local v0, com:Lcom/bitauto/autoeasy/selectcar/Object/Comment;
    invoke-virtual {v0}, Lcom/bitauto/autoeasy/selectcar/Object/Comment;->getLevel()I

    move-result v6

    packed-switch v6, :pswitch_data_0

    .line 80
    :goto_2
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    .line 84
    :pswitch_0
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->badcommentList:Ljava/util/ArrayList;

    invoke-virtual {v6, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Lcom/bitauto/autoeasy/tool/WSError; {:try_start_0 .. :try_end_0} :catch_1

    goto :goto_2

    .line 103
    .end local v0           #com:Lcom/bitauto/autoeasy/selectcar/Object/Comment;
    .end local v2           #i:I
    .end local v3           #jArr:Lorg/json/JSONArray;
    .end local v4           #jObj:Lorg/json/JSONObject;
    .end local v5           #str:Ljava/lang/String;
    :catch_0
    move-exception v6

    move-object v1, v6

    .line 104
    .local v1, e:Lorg/json/JSONException;
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->TA_G:Ljava/lang/String;

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "error :"

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 105
    iput-object v9, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->badcommentList:Ljava/util/ArrayList;

    .line 106
    iput-object v9, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->generalCommentList:Ljava/util/ArrayList;

    .line 107
    iput-object v9, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->goodCommentList:Ljava/util/ArrayList;

    .line 108
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    goto :goto_1

    .line 87
    .end local v1           #e:Lorg/json/JSONException;
    .restart local v0       #com:Lcom/bitauto/autoeasy/selectcar/Object/Comment;
    .restart local v2       #i:I
    .restart local v3       #jArr:Lorg/json/JSONArray;
    .restart local v4       #jObj:Lorg/json/JSONObject;
    .restart local v5       #str:Ljava/lang/String;
    :pswitch_1
    :try_start_1
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->badcommentList:Ljava/util/ArrayList;

    invoke-virtual {v6, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_1
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_1} :catch_0
    .catch Lcom/bitauto/autoeasy/tool/WSError; {:try_start_1 .. :try_end_1} :catch_1

    goto :goto_2

    .line 109
    .end local v0           #com:Lcom/bitauto/autoeasy/selectcar/Object/Comment;
    .end local v2           #i:I
    .end local v3           #jArr:Lorg/json/JSONArray;
    .end local v4           #jObj:Lorg/json/JSONObject;
    .end local v5           #str:Ljava/lang/String;
    :catch_1
    move-exception v6

    move-object v1, v6

    .line 110
    .local v1, e:Lcom/bitauto/autoeasy/tool/WSError;
    iput-object v9, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->badcommentList:Ljava/util/ArrayList;

    .line 111
    iput-object v9, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->generalCommentList:Ljava/util/ArrayList;

    .line 112
    iput-object v9, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->goodCommentList:Ljava/util/ArrayList;

    .line 113
    invoke-virtual {v1}, Lcom/bitauto/autoeasy/tool/WSError;->printStackTrace()V

    goto :goto_1

    .line 90
    .end local v1           #e:Lcom/bitauto/autoeasy/tool/WSError;
    .restart local v0       #com:Lcom/bitauto/autoeasy/selectcar/Object/Comment;
    .restart local v2       #i:I
    .restart local v3       #jArr:Lorg/json/JSONArray;
    .restart local v4       #jObj:Lorg/json/JSONObject;
    .restart local v5       #str:Ljava/lang/String;
    :pswitch_2
    :try_start_2
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->generalCommentList:Ljava/util/ArrayList;

    invoke-virtual {v6, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_2

    .line 93
    :pswitch_3
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->goodCommentList:Ljava/util/ArrayList;

    invoke-virtual {v6, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_2

    .line 96
    :pswitch_4
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->goodCommentList:Ljava/util/ArrayList;

    invoke-virtual {v6, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_2
    .catch Lorg/json/JSONException; {:try_start_2 .. :try_end_2} :catch_0
    .catch Lcom/bitauto/autoeasy/tool/WSError; {:try_start_2 .. :try_end_2} :catch_1

    goto :goto_2

    .line 82
    nop

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_4
    .end packed-switch
.end method

.method public createComment(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/Comment;
    .locals 5
    .parameter "obj"

    .prologue
    .line 123
    new-instance v0, Lcom/bitauto/autoeasy/selectcar/Object/Comment;

    invoke-direct {v0}, Lcom/bitauto/autoeasy/selectcar/Object/Comment;-><init>()V

    .line 125
    .local v0, comment:Lcom/bitauto/autoeasy/selectcar/Object/Comment;
    :try_start_0
    const-string v2, "author"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Comment;->setAuthor(Ljava/lang/String;)V

    .line 126
    const-string v2, "updated"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    const-string v3, "T"

    const-string v4, " "

    invoke-virtual {v2, v3, v4}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Comment;->setUpdated(Ljava/lang/String;)V

    .line 127
    const-string v2, "content"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Comment;->setContent(Ljava/lang/String;)V

    .line 128
    const-string v2, "title"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Comment;->setTitle(Ljava/lang/String;)V

    .line 129
    const-string v2, "level"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Comment;->setLevel(I)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    move-object v2, v0

    .line 134
    :goto_0
    return-object v2

    .line 131
    :catch_0
    move-exception v2

    move-object v1, v2

    .line 132
    .local v1, e:Lorg/json/JSONException;
    const-string v2, "BrandParser"

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "error :"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 133
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    .line 134
    const/4 v2, 0x0

    goto :goto_0
.end method

.method public getBadcommentList()Ljava/util/ArrayList;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/Comment;",
            ">;"
        }
    .end annotation

    .prologue
    .line 65
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->badcommentList:Ljava/util/ArrayList;

    return-object v0
.end method

.method public getGeneralCommentList()Ljava/util/ArrayList;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/Comment;",
            ">;"
        }
    .end annotation

    .prologue
    .line 61
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->generalCommentList:Ljava/util/ArrayList;

    return-object v0
.end method

.method public getGoodCommentList()Ljava/util/ArrayList;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/Comment;",
            ">;"
        }
    .end annotation

    .prologue
    .line 57
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CommentParser;->goodCommentList:Ljava/util/ArrayList;

    return-object v0
.end method
